package com.itheima.pojo;

import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

/**
 * @author by itheima
 * @Date 2022/4/27
 * @Description
 */
@Data//等价于getter  setter  toString
//@Getter
//@Setter
//@ToString
//@EqualsAndHashCode//重写定义equals 和 hash方法
@NoArgsConstructor//定义无参构造
@AllArgsConstructor//定义有参构造
@Builder//基于构造器模式构建对象
@Slf4j//开启日志
@Accessors(chain = true)//链式调用
public class Book {
    private Integer id;
    private String type;
    private String name;
    private String description;

    public static void main(String[] args) {
        Book book = new Book();
        book.setId(1);
        book.setDescription("xxx");
        System.out.println(book.toString());
        //测试有参构造
        Book book2 = new Book(1, "type", "zhagnsan", "xx");
        //测试构造器模式构建对象 可以选择部分参数，构建对象
        Book book3 = Book.builder().id(1).name("zhangsan").description("xxx").build();
        //测试链式调用
        Book book4 = new Book().setId(1).setDescription("xxx").setName("zhangsan");
    }
}
